import { defHttp } from '/@/utils/http/axios';
import { IGetSupplierDropdownResponse } from '/@/types/system/auxiliary/supplier/dropdown';
import {
  IPostSupplierListRequest,
  IPostSupplierListResponse,
} from '/@/types/system/auxiliary/supplier/list';
import { IGetRawSupplierDetailsResponse } from '/@/types/system/auxiliary/supplier/details';
import { IPostSupplierUpdateRaw } from '/@/types/system/auxiliary/supplier/update';
import { IPostSupplierAddRequest } from '/@/types/system/auxiliary/supplier/add';

/**
 * 供应商类别下拉框
 */
export const apiGetSupplierDropdown = () =>
  defHttp.get<IGetSupplierDropdownResponse>({ url: `/system/auxiliary/supplier/dropdown` });
/**
 * 供应商类别列表
 */
export const apiPostSupplierList = (params: IPostSupplierListRequest) =>
  defHttp.post<IPostSupplierListResponse>({ url: `/system/auxiliary/supplier/list`, params });
/**
 * 供应商类别详情
 */
export const apiGetSupplierDetailsPath = (id: string | number) =>
  defHttp.get<IGetRawSupplierDetailsResponse>({ url: `/system/auxiliary/supplier/details/${id}` });
/**
 * 修改供应商类别
 */
export const apiPostSupplierUpdatePath = (id: string | number, params: IPostSupplierUpdateRaw) =>
  defHttp.post({ url: `/system/auxiliary/supplier/update/${id}`, params });
/**
 * 删除供应商类别
 */
export const apiPostSupplierDeletePath = (id: string | number) =>
  defHttp.post({ url: `/system/auxiliary/supplier/delete/${id}` });
/**
 * 新增供应商类别
 */
export const apiPostSupplierAdd = (params: IPostSupplierAddRequest) =>
  defHttp.post({ url: `/system/auxiliary/supplier/add`, params });
